/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "user_privateinfo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "UserPrivateInfo.findAll", query = "SELECT u FROM UserPrivateInfo u"),
    @NamedQuery(name = "UserPrivateInfo.findById", query = "SELECT u FROM UserPrivateInfo u WHERE u.id = :id"),
    @NamedQuery(name = "UserPrivateInfo.findByUserID", query = "SELECT u FROM UserPrivateInfo u WHERE u.userID = :userID"),
    @NamedQuery(name = "UserPrivateInfo.findByUserName", query = "SELECT u FROM UserPrivateInfo u WHERE u.userName = :userName"),
    @NamedQuery(name = "UserPrivateInfo.findBySfID", query = "SELECT u FROM UserPrivateInfo u WHERE u.sfID = :sfID"),
    @NamedQuery(name = "UserPrivateInfo.findByAlterUserID", query = "SELECT u FROM UserPrivateInfo u WHERE u.alterUserID = :alterUserID"),
    @NamedQuery(name = "UserPrivateInfo.findByCreateTime", query = "SELECT u FROM UserPrivateInfo u WHERE u.createTime = :createTime"),
    @NamedQuery(name = "UserPrivateInfo.findByTimeStamp", query = "SELECT u FROM UserPrivateInfo u WHERE u.timeStamp = :timeStamp")})
public class UserPrivateInfo implements Serializable {
	public static byte[] EnCode(UserPrivateInfo msg) throws IOException {
		Codec<UserPrivateInfo> Lcode = ProtobufProxy.create(UserPrivateInfo.class);
		return Lcode.encode(msg);
	}
	public static UserPrivateInfo DeCode(byte[] data) throws IOException {
	Codec<UserPrivateInfo> Lcode = ProtobufProxy.create(UserPrivateInfo.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "UserID")
    @Protobuf
	private String userID;
    @Basic(optional = false)
    @Column(name = "UserName")
    private String userName;
	@Protobuf
	private byte[] userNameBit;
    @Basic(optional = false)
    @Column(name = "SfID")
    @Protobuf
	private String sfID;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public UserPrivateInfo() {
    }

    public UserPrivateInfo(Integer id) {
        this.id = id;
    }

    public UserPrivateInfo(Integer id, String userID, String userName, String sfID) {
        this.id = id;
        this.userID = userID;
        this.userName = userName;
		this.userNameBit = CodeTool.StringToBit(userName);
        this.sfID = sfID;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserID() {
        return userID;
    }

    public void setUserID(String userID) {
        this.userID = userID;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
        this.setUserNameBit(CodeTool.StringToBit(userName));
    }

    public String getSfID() {
        return sfID;
    }

    public void setSfID(String sfID) {
        this.sfID = sfID;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserPrivateInfo)) {
            return false;
        }
        UserPrivateInfo other = (UserPrivateInfo) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.UserPrivateInfo[ id=" + id + " ]";
    }

    public byte[] getUserNameBit() {
        return userNameBit;
    }

    public void setUserNameBit(byte[] userNameBit) {
        this.userNameBit = userNameBit;
		this.userName = CodeTool.BitToString(userNameBit);
    }
    
}
